package boogui.money;

import java.util.Scanner;

import boogui.member.MemberDAO;
import boogui.member.MemberSQL;
import boogui.member.MemberVO;
import boogui.movie.MovieAreaVO;
import boogui.movie.MovieDAO;
import boogui.movie.MovieVO;
import boogui.movie.S_MovieSeatDialog;

public class reservationService implements IreservationService{
	
	Scanner sc = new Scanner(System.in);
	
	private reservationDAO rdao = new reservationDAO();
	private MemberDAO mdao = new MemberDAO();
	private MovieVO mvvo = new MovieVO();
	private MovieDAO mvdao = new MovieDAO();
	private MovieAreaVO mavo = new MovieAreaVO();
	private S_MovieSeatDialog msd = new S_MovieSeatDialog();
	private MemberSQL ms = new MemberSQL();
	
	@Override
	public void createReservation() {
		
		reservationVO rvo = new reservationVO();
		System.out.println("예약하기");
		System.out.println("몇명 예약하실것인지 입력해주세요");
		String a = ms.getMemnoViewSQL();
		rvo.memno = a;
		rvo.movno = mvvo.getMovno();
		rvo.cineno = mavo.getCineno();
		rvo.setPeople(sc.nextInt());
		rvo.seat = msd.as;
		rvo.setPrice(rvo.people * 8000);
		if(rvo.people == rvo.seat){
			if(rdao.insertVation(rvo))
				System.out.println("예약완료");
		}else
			System.out.println("예약실패 사람숫자와 체크한 숫자를 비교해주세요");
		
	}

	

	@Override
	public void removeReservation() {
		
		readReservation(null);
		readReservation2(null);
		readReservation3(null);
		readReservation4(null);
		reservationVO rvo = new reservationVO();
		
		System.out.println("삭제하시겠습니까?");
		
		if(rdao.deleteVation(rvo))
			System.out.println("예매 취소가 완료 되었습니다.");
		else
			System.out.println("예매 취소를 다시 시도해주시기 바랍니다");
	}
	
	@Override
	public void readReservation(MemberVO mbvo) {
		reservationVO rvo = new reservationVO();
		mbvo.getMemno();
		if(mbvo.getMemno().equals(rvo.getMemno())){
		System.out.println(mbvo.getMemname());
		}else System.out.println("틀려요~");
		
	}
	
	@Override
	public void readReservation2(MovieVO mvvo) {
		
		reservationVO rvo = new reservationVO();
		if(mvvo.getMovno().equals(rvo.getMovno())){
			System.out.println(mvvo.getMovtitle());
		}else System.out.println("틀리당께요");
		
		
	}
	
	@Override
	public void readReservation3(MovieAreaVO mavo) {
		
		reservationVO rvo = new reservationVO();
		if(mavo.getCineno().equals(rvo.getCineno())){
			System.out.println(mavo.getCinename());
		}else System.out.println("아따 틀리당게");
		
	}

	@Override
	public void readReservation4(reservationVO rvo) {
		
		MemberVO mvo = new MemberVO();
		if(mvo.getMemno().equals(rvo.getMemno())){
			System.out.println(rvo.getPeople());
			System.out.println(rvo.getPrice());
		}else System.out.println("흐미 틀렸당게");
		
	}



	
	
}